package com.mobile.challenge.ui.report.adapter

import androidx.fragment.app.Fragment
import androidx.viewpager2.adapter.FragmentStateAdapter
import com.mobile.challenge.ui.report.model.PagerFragmentModel

/**
 * @Author Touge
 * @Date 2020/9/15 22:20
 * @Description
 */
class ReportViewPagerAdapter(fragment: Fragment) : FragmentStateAdapter(fragment) {

    var fragmentList = ArrayList<PagerFragmentModel>(0)
        set(value) {
            field = value
            notifyDataSetChanged()
        }

    override fun getItemCount(): Int {
        return fragmentList.size
    }

    override fun createFragment(position: Int): Fragment {
        return fragmentList[position].fragment
    }
}